#pragma once
#include "VARBinary.h"

class CDataNode : public CVARBinary
{
	friend class CDataArray;
public:
	CDataNode(intptr_t id, CVARBinary&data, bool copyValue = true);
	CDataNode(intptr_t id, LPVOID value, intptr_t length, bool copyValue = true);
protected:
	intptr_t m_id;
};

class CDataArray
{
public:
	CDataArray();
	~CDataArray();
	void clear();
	void operator =(const CDataArray& src);
	__forceinline intptr_t add(CDataNode *pNode){ return insert(count, pNode); }
	intptr_t find(intptr_t id);
	CDataNode *remove(intptr_t index);
	intptr_t insert(intptr_t index, CDataNode *pNode);
protected:
	intptr_t count;
	CDataNode **data;
};
